import { getEnvConfig } from "../../../../utils/iocUtils";
import { getCurrentOrganizationId, getCurrentUserId } from "../../../../utils/utils";
var organizationId = getCurrentOrganizationId();
var userId = getCurrentUserId();

var _getEnvConfig = getEnvConfig(),
    CPAAS_PLATFORM = _getEnvConfig.CPAAS_PLATFORM;

export default (function (_ref) {
  var searchCode = _ref.searchCode;
  return {
    paging: false,
    primaryKey: 'searchId',
    transport: {
      create: function create(_ref2) {
        var data = _ref2.data;
        return {
          url: "".concat(CPAAS_PLATFORM, "/v1/").concat(organizationId, "/search-config"),
          data: data[0]
        };
      },
      update: function update(_ref3) {
        var data = _ref3.data;
        return {
          url: "".concat(CPAAS_PLATFORM, "/v1/").concat(organizationId, "/search-config/").concat(data[0].searchId),
          method: 'put',
          data: data[0]
        };
      }
    },
    fields: [{
      name: 'searchName',
      type: 'string',
      label: '名称',
      required: true
    }, {
      name: 'defaultFlag',
      type: 'boolean',
      label: '默认',
      defaultValue: 0,
      trueValue: 1,
      falseValue: 0
    }, {
      name: 'remark',
      type: 'string',
      label: '描述'
    }, {
      name: 'userId',
      type: 'number',
      defaultValue: userId
    }, {
      name: 'searchId',
      type: 'number'
    }, {
      name: 'searchCode',
      type: 'string',
      defaultValue: searchCode
    }]
  };
});